package net.net23.sysdent.server.jdo.pojos;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.gwt.user.client.rpc.IsSerializable;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class User implements IsSerializable {

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;

	@Persistent
	private String name;

	@Persistent
	private String mail;

	@Persistent
	private Boolean active;

	public User(Long id, String name, String mail, Boolean active) {
		super();
		this.id = id;
		this.setName(name);
		this.setMail(mail);
		this.setActive(active);
	}

	public User(String name, String mail, Boolean active) {
		super();
		this.setName(name);
		this.setMail(mail);
		this.setActive(active);
	}

	public User(String name, String mail) {
		super();
		this.setName(name);
		this.setMail(mail);
		this.setActive(true);
	}

	public Long getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getMail() {
		return mail;
	}

	public void setMail(String mail) {
		this.mail = mail;
	}

	public void setActive(Boolean active) {
		this.active = active;
	}

	public Boolean isActive() {
		return active;
	}
	
	@Override
	public String toString() {
		return "{id: " + id + //
		", name: " + name + //
		", mail: " + mail + //
		", active: " + active + "}";
	}
}
